<template>
  <div class="main device-left-container">
    <header class="header-container">
      <div class="title">
        <span>供配电系统</span>
      </div>
    </header>
    <div class="chart-box" v-if="show">
      <div class="chart" :style="'height:' + rowHeight* 4 + 'px'">
        <Sum></Sum>
      </div>
      <div class="chart" :style="'height:' + rowHeight* 4 + 'px'">
        <Power></Power>
      </div>
      <div class="chart" :style="'height:' + rowHeight* 4 + 'px'">
        <Alert></Alert>
      </div>
    </div>
  </div>
</template>

<script>
import Power from './power'
import Sum from './sum'
import Alert from './alert'

export default {
  name: 'DeviceLeft',

  components: {
    Power,
    Sum,
    Alert
  },

  data () {
    return {
      rowHeight: 100,
      show: false
    }
  },

  mounted () {
    this.$nextTick(() => {
      let containerHeight = this.$el.clientHeight - 90
      this.rowHeight = (containerHeight) / 12
      setTimeout(() => {
        this.show = true
      }, 0)
    })
  },

  methods: {
    onResize () {
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '../../../../assets/stylus/base'

.device-left-container {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  font-size: 14px;
  overflow: hidden;

  .header-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    line-height: 50px;
    font-size: 24px;
    padding-left: 10px;
  }

  .chart-box {
    width: 100%;
    height: 100%;
    padding-top: 50px;
    box-sizing: border-box;

    .chart {
      margin-top: 10px;
      background: red;
    }
  }
}
</style>
